'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Record extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      models.Record.belongsTo(models.Category)
      models.Record.belongsTo(models.Service)
      models.Record.belongsTo(models.Customer)
      models.Record.belongsTo(models.User)
      models.Record.belongsTo(models.Channel)
      models.Record.belongsTo(models.Location)
      models.Record.belongsTo(models.Audit)
      models.Record.belongsTo(models.Bank)
    }
  }
  Record.init({
    categoryId: DataTypes.INTEGER,
    serviceId: DataTypes.INTEGER,
    customerId: DataTypes.INTEGER,
    channelId: DataTypes.INTEGER,
    locationId: DataTypes.INTEGER,
    eLocation: DataTypes.STRING,
    userId: DataTypes.INTEGER,
    bankId: DataTypes.INTEGER,
    acceptedTime: DataTypes.DATE,
    endTime: DataTypes.DATE,
    notes: DataTypes.STRING,
    auditUserId: DataTypes.INTEGER,
    auditId: DataTypes.INTEGER,
    auditSuggest: DataTypes.STRING,
  }, {
    sequelize,
    modelName: 'Record',
  });
  return Record;
};